[MSBuild] Problem with setting properties 's values.

Posted by Nam Gi VU on Stack Overflow See other posts from Stack Overflow or by Nam Gi VU
Published on 2010-03-25T11:35:21Z Indexed on 2010/03/25 22:03 UTC
Read the original article Hit count: 192

Filed under:
|

Let's consider the below example. There, I have:

  1. target MAIN call target t then call target tt.
  2. target t call target ttt, target tt call target tttt.
  3. target t define property aa, target ttt modify aa.
  4. target tttt try to print property aa 's value.
  5. in short we have: MAIN -> {t -> {ttt->modify aa, define aa}, tt -> tttt -> print aa}

But in target tttt, we can't "see" aa's updated value (by ttt)! Please help me to make that value visible to target tttt. Thank you!

The whole script is as below:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="MAIN" >
  <Target Name="MAIN" >
    <CallTarget Targets="t" />
    <CallTarget Targets="tt" />
  </Target>

  <Target Name="t">
    <Message Text="t" />
    <PropertyGroup>
      <aa>1</aa>
    </PropertyGroup>
    <CallTarget Targets="ttt" />
  </Target>

  <Target Name="tt">
    <Message Text="tt" />
    <CallTarget Targets="tttt" />
  </Target>

  <Target Name="ttt">
    <PropertyGroup>
      <aa>122</aa>
    </PropertyGroup>
    <Message Text="ttt" />
  </Target>

  <Target Name="tttt">
    <Message Text="tttt" />
    <Message Text="tttt:$(aa)" />
  </Target>

</Project>

© Stack Overflow or respective owner

Related posts about msbuild

Related posts about property